export default {
    namespaced: true,
    state: {
        todiList:[],
        itemVal:"",
    },
    mutations: {
        addTodoLiST(state) {      
            let item = {
                id: state.todiList.length > 0 && state.todiList[state.todiList.length - 1].id + 1 || 100,
                name: state.itemVal,
                idDone:false
            }
            state.todiList.push(item)
            state.itemVal=""
        },
        addTodoListArray(state,arr) {
            state.todiList=arr
        },
        clearDone(state) {
          const itemArr=  state.todiList.filter((item) => {
                return item.idDone==false
          })
          state.todiList=itemArr
        }
    },
    actions:{}
}